<template>
    <view>
        <view class="bgkjnfrrt"></view>
		<view class="pr pd pm40">
			<view @tap="keyinfo(sd.id)" class="kjhhdrte" v-for="sd in list">
				<view class="pt40 pl50 row">
					<image :src="sd.avatar" class="ujnhsert cz yj"></image>
					<view class="col pl40 fz32 pt10">
						{{sd.name}}
						<text style="color: #4CD964;padding-left:30upx ;" v-if="sd.status==0"> 已禁用</text>
						<view class="fz28 z3 mt10">
							{{sd.phone}}
						</view>
					</view>
				</view>
				<view class="mt40 fz28 z3 pl50">
					起止时间:{{sd.begin_time}}-{{sd.end_time}}
				</view>
				<uni-icons type="right" class="righhggsetr"></uni-icons>
			</view>
			<view class="dsfsdtyswert pr" v-if="list.length<=0">
				<image src="../../static/img/qs/sdfsdfsfa.png" mode="widthFix" class="cz jbnmknxertwe"></image>
				<image src="../../static/img/qs/sdfsdfsfb.png" mode="widthFix" class="jkjknnjjxert"></image>
			</view>
		</view>
    </view>
</template>
<script>
    export default {
        data() {
            return {				
				list:[],
				carid:"",
				devsn:'',
				carinfo:{}
			}
        },
        components: {},
        methods: {
			async carlist(car){				
				let clist= await this.get('/api/car/'+car+'/keys')
				this.list=clist.data
				console.log("得到的车辆list",clist)
			},
			hidenadd(){
				// if(){
					
				// }
				 const webView = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效，非v3编译模式使用this.$mp.page.$getAppWebview()
				// 修改buttons 
				webView.setTitleNViewButtonStyle(0, {
				width: '0',
				});
			},
			keyinfo(keysid){
				uni.navigateTo({
					url:"/pages/leftSideMenu/ViceKeyinfo?devsn="+this.devsn+"&carid="+this.carid+'&type=1&keysid='+keysid
				})
			}
		},
		onNavigationBarButtonTap() {
			// console.log(this.carid);
			// console.log(this.devsn);
			uni.navigateTo({
				url:'/pages/leftSideMenu/AddViceKey?carid='+this.carid+'&devsn='+this.devsn+'&type=0'
			})
		},
		onLoad(options) {				
			this.carid=options.id
			this.devsn=options.devsn
			this.carlist(options.id)
			// console.log(options);
		},
		// onShow(options) {
		// 	// this.hidenadd()
		// },
        mounted() {}
    }

</script>
<style  scoped>
	.bgkjnfrrt{
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background-color: #E8E8E8;
	}
	.kjhhdrte{
		height:274upx;
		background:rgba(255,255,255,1);
		box-shadow:0upx 6upx 12upx rgba(0,0,0,0.16);
		border-radius:12upx;
		margin-top: 30upx;
		position: relative;
	}
	.ujnhsert{
		width: 110upx;
		height: 110upx;
	}
	.righhggsetr{
		position: absolute;
		right: 38upx;
		top: 124upx;
	}
</style>
